﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using API.Models;
using PPG.DataAccess;
using System.Configuration;

namespace API.Controllers
{
    public class DeleteReferralController : ApiController
    {
        DataSourceCommunicator dsComm = new DataSourceCommunicator(DataSourceCommunicator.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"].ToString(), ConfigurationManager.AppSettings["DBUserName"].ToString(), ConfigurationManager.AppSettings["DBPassword"].ToString());
        public int PostDeleteReferral([FromBody]DeleteReferralRequest request)
        {
           
            dsComm.AddParameter("@ParamReferralID", request.ReferralID);
            dsComm.AddParameter("@ParamLoginID", request.LoginID);

            int i = int.Parse(dsComm.ExecuteScalar("dbo.spDeleteReferral").ToString());

            return i;
            
        }

        public HttpResponseMessage OptionsValidateUserLogin()
        {
            var response = new HttpResponseMessage();
            response.StatusCode = HttpStatusCode.OK;
            return response;
        }

    }
}
